angular.module('elife.services')
    .factory('AllUsersService', function() {
        var list = [{
            name: '张静',
            phone: '18217221721',
            certNo: '340881199108171348',
            certType: 'A',
            age: '25',
            nationality: '0156',
            email: '1195371622@qq.com',
            birthday: '1991-08-17',
            gender: 2,
            certExpireType: 1,
            certExpireDate: '2099-12-31',
            address: '上海市徐家汇',
            money: 300000,
            send: 1,
            zipcode: 120051,
            inhabitantType: 'C',
            profession: 2,
            cityType: 1,
            areaType: 1,
        }, {
            name: '张三',
            phone: '18701828309',
            certNo: '340881188019910812',
            certType: 'G',
            age: '25',
            nationality: '0344',
            email: '1222622@qq.com',
            birthday: '1991-08-17',
            gender: 2,
            certExpireType: 2,
            certExpireDate: '2018-09-09',
            address: '上海市闵行区',
            money: 100000,
            send: 2,
            zipcode: 123991,
            inhabitantType: 'C',
            profession: 2,
            cityType: 1,
            areaType: 2,
        }, {
            name: '王五',
            phone: '13709090112',
            certNo: '81713481221',
            certType: 'G',
            age: '25',
            nationality: '0344',
            email: '1195371601@qq.com',
            birthday: '1992-01-12',
            gender: 2,
            certExpireType: 1,
            certExpireDate: '2099-12-31',
            address: '上海市浦东新区',
            money: 100000,
            send: 2,
            zipcode: 123001,
            inhabitantType: 'C',
            profession: 2,
            cityType: 1,
            areaType: 3,
        }, {
            name: '李四',
            phone: '13709090121',
            certNo: '3012712212',
            certType: 'G',
            age: '25',
            nationality: '0344',
            email: '11953712@qq.com',
            birthday: '1980-02-17',
            gender: 1,
            certExpireType: 1,
            certExpireDate: '2099-12-31',
            address: '上海市普陀区',
            money: 400000,
            send: 2,
            zipcode: 123451,
            inhabitantType: 'C',
            profession: 2,
            cityType: 1,
            areaType: 4,
        }];
        return {
            allUsers: function() {
                return list;
            },
            selectUsers: function(keyWord, checktype) {
                var tempList = [];
                for (var i = 0; i < list.length; i++) {
                    var index = list[i];
                    if (index[checktype].indexOf(keyWord) >= 0) {
                        tempList.push(list[i]);
                    }
                }
                return tempList;

            }
        }
    });